<template>
  <el-form :model="form" ref="numberValidateForm" label-width="100px" class="demo-ruleForm">
    <el-form-item
        label="收入"
        prop="money"
        :rules="[
      { required: true, message: '收入不能为空'},
      { type: 'number', message: '收入必须为数字值'}
    ]"
    >
      <el-input type="money" v-model.number="form.money" autocomplete="off"></el-input>元
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="submitForm()">提交</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
import router from "@/router";
export default {
  data() {
    return {
      form: {
        money: 0
      }
    };
  },
  methods: {
    submitForm() {
      this.axios({
        url: '/api/tax/get/' + this.form.money,
        method: 'get'
      }).then(({data}) => {
        if (data.code === 200) {
          this.$cookies.config('60*60*24', '')
          this.$cookies.set('data', data.data)
          router.push('/result')
        } else {
          this.open(data.msg, 'error')
        }
      })
    }
  }
}
</script>